﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.CompositeUI;
using Microsoft.Practices.CompositeUI.SmartParts;
using Microsoft.Practices.ObjectBuilder;
using WPFCABShell.Shell.Interface.Services.Options;
using WPFCABShell.Shell.Interface;

namespace OptionsDemo
{
	public sealed class Module : ModuleInit, IBuilderAware
	{
		private IOptionsService _optionsService;
		private WorkItem _workItem;

		[InjectionConstructor]
		public Module([ServiceDependency] IOptionsService optionsService, [ServiceDependency] WorkItem workItem)
		{
			_optionsService = optionsService;
			_workItem = workItem;
		}

		void IBuilderAware.OnBuiltUp(string id)
		{
			//register the options pane
			_optionsService.Register(ExtensionSites.Options.Name, "Example Options", typeof(MyOptionsPane), null);
			//show the explanatory view
			_workItem.Workspaces[WPFCABShell.Shell.Interface.Workspaces.MainWorkspace].Show(_workItem.SmartParts.AddNew<OptionsView>(), new SmartPartInfo("Options", null));
		}

		void IBuilderAware.OnTearingDown()
		{
		}
	}
}
